<!DOCTYPE html>
<html xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>class02</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>


<div id="app">
    <!--<div v-bind:class="{mydiv:flag,mydiv2:hasborder}" class="mydiv1">{{msg}}</div>-->
    <div v-bind:class="classObj" class="mydiv1">{{msg}}</div>
    <div v-bind:class="[mydivClass,mydiv2Class]">{{msg}}</div>
</div>


</body>


<script>
    var app = new Vue({
        el: '#app',
        data: {
            msg: 'hhh',
            flag: true,
            hasborder: true,
            mydivClass: 'mydiv',
            mydiv2Class: 'mydiv2',
        },
        computed: {
            classObj() {
                return{
                    mydiv:this.flag,
                    mydiv2:this.hasborder
                }
            },
        }
    })

</script>

<style>
    .mydiv {
        font-weight: bold;
        color: #ff0000;
    }

    .mydiv1 {
        font-size: 30px;
    }

    .mydiv2 {
        border: 1px solid #dedede;
    }
</style>
</html>
